import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, OneToMany } from "typeorm";

@Entity()
export class CategoryList {

  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column()
  description: string;

  @ManyToOne(type => CategoryList, category => category.children)
  parent: CategoryList;

  @OneToMany(type => CategoryList, category => category.parent)
  children: CategoryList[];
}

